package com.test;

import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.Event;
import java.awt.Graphics;
import java.awt.Image;

public class Album extends Applet {
	private static final long serialVersionUID = 1L;

	AudioClip audio = null;
//

	Image[] images = null;
	int i = 0;

	public void init() {
		// ȡ�������ļ�
		String  musicname = getParameter("musicname");
		audio = getAudioClip(getCodeBase(), musicname);

		// ȡ��ͼƬ�ļ�
		String[] imagename = getParameter("imagefile").split(",");
		images = new Image[imagename.length];

		for (int i = 0; i < imagename.length; i++) {
			images[i] = this.getImage(this.getDocumentBase(), imagename[i]);
		}
	}
	
	// ����ʱ��������
	public void start() {
		audio.loop();
	}

	public void paint(Graphics g) {
		g.drawImage(images[i], 0, 0, null);
		repaint();
	}

	// ��갴��ѭ��
	public boolean mouseDown(Event evt, int x, int y) {
		i++;
		i = i % 3;
		repaint();
		return true;
	}
}
